package com.bi.design.pojo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.bi.design.consts.TimeConsts;
import org.springframework.format.annotation.DateTimeFormat;

import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.Objects;

public class TimePageQuery extends BasePage {

    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private LocalDate searchTime;

    public String getSearchTime() {
        if (Objects.nonNull(searchTime)) {
            return searchTime.format(DateTimeFormatter.ofPattern(TimeConsts.DATE_FORMATTER_DATE));
        }
        return null;
    }

    public void setSearchTime(LocalDate searchTime) {
        this.searchTime = searchTime;
    }


    @Override
    public String toString() {
        return "TimePageQuery{" +
                "searchTime=" + searchTime +
                '}';
    }
}
